#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QStackedWidget>
#include <QListWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QFileDialog>
#include <QMessageBox>
#include "database.h"
#include "scoreentry.h"
#include "scorequerybydate.h"
#include "monthlyquery.h"
#include "dormitorymanage.h"

QT_BEGIN_NAMESPACE
namespace Ui
{
    class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    // 获取数据库实例
    Database *getDatabase() { return &database; }

private slots:
    void onMenuItemClicked(int index);
    void exportDatabase();
    void importDatabase();

private:
    Ui::MainWindow *ui;
    Database database;
    QListWidget *menuList;
    QStackedWidget *contentStack;

    // 页面组件
    ScoreEntry *scoreEntryPage;
    ScoreQueryByDate *scoreQueryByDatePage;
    MonthlyQuery *monthlyQueryPage;
    DormitoryManage *dormitoryManagePage;

    void setupUi();
    void initializeDatabase();
};
#endif // MAINWINDOW_H
